package main

import "fmt"

func testAppendSlice() {
	a := []int{1, 2, 3, 4}
	b := []int{11, 12, 13, 14}
	s := make([]int, 3, 10)
	copy(s, a)
	fmt.Printf("len(s) = %d, cap(s) = %d, %#v\n", len(s), cap(s), s)
	s0 := s
	s[1] = 5
	fmt.Printf("len(s0) = [%d, %d], s0 = %#v, s1 = %#v\n", len(s0), cap(s0), s0, s)
	s = append(s, a...)
	fmt.Printf("len(s) = %d, s0 = %#v, s1 = %#v\n", len(s), s0, s)
	s = append(s, b...)
	fmt.Printf("len(s) = %d, s0 = %#v, s1 = %#v\n", len(s), s0, s)
}

func testAppendSlice2() {
	ary := [10]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
	a := []int{1, 2, 3, 4}
	b := []int{11, 12, 13, 14}
	var s []int = ary[:3]
	fmt.Printf("len(s) = %d, cap(s) = %d, %#v\n", len(s), cap(s), s)
	s0 := s
	s[1] = 5
	fmt.Printf("len(s0) = [%d, %d], s0 = %#v, s1 = %#v\n", len(s0), cap(s0), s0, s)
	s = append(s, a...)
	fmt.Printf("len(s) = %d, ary = %#v, s0 = %#v, s1 = %#v\n", len(s), ary, s0, s)
	s = append(s, b...)
	fmt.Printf("len(s) = %d, ary = %#v, s0 = %#v, s1 = %#v\n", len(s), ary, s0, s)
}
